<?php
include_once "topo.php";

$inscricao = new inscricao();
if(valida::cpf($_GET["cod"])){
    $cod = ext_0($_GET["cod"]);
    $inscricao->carregar($cod);
}else{
    $cod = '';
}

if($_POST["btn_ok"] == "Ok"){
    $cpf = $_POST["cpf"];
    if(valida::cpf($cpf)){
        $inscricao->carregar($cpf);
        $cod = $inscricao->get_cpf();
    }
}
?>
                <div id="form_boleto">
                    <form action="" method="post">
                        <label>CPF</label>
                        <input type="number" name="cpf" value="<?php echo $inscricao->get_cpf(); ?>" id="cpf" onBlur="if(!valida.cpf(this.value)){erro(this.id)}" onFocus="clean(this.id)" OnKeyUp="apenas_num(this)">
                        <?php if(date("Y-m-d") <= "2013-06-30"){ ?>
                        <input type="submit" name="btn_ok" value="Ok" onClick="aviso();">
                        <?php }else{ ?>
                        <input type="submit" name="btn_ok" value="Ok">
                        <?php } ?>
                    </form>
                    <?php
                    if($cod != ''){
                    ?>
                    <br>
                    <div id="visao">
                        <label>Inscrição</label>
                        <div><?php echo $inscricao->get_id(); ?></div>
                    </div>
                    <div id="visao">
                        <label>Nome</label>
                        <div><?php echo $inscricao->get_nome(); ?></div>
                    </div>
                    <div id="visao">
                        <label>E-mail</label>
                        <div><?php echo $inscricao->get_email(); ?></div>
                    </div>
                    <div id="visao">
                        <label>Endereço</label>
                        <div><?php echo $inscricao->get_endereco(); ?></div>
                    </div>
                    <div id="visao">
                        <label>Cidade</label>
                        <div><?php echo $inscricao->get_cidade()." - ".$inscricao->get_estado(); ?></div>
                    </div>
                    <div id="visao">
                        <label>CEP</label>
                        <div><?php echo $inscricao->get_cep(); ?></div>
                    </div>
                    <div id="visao">
                        <label>Instituição</label>
                        <div><?php echo $inscricao->get_instituicao(); ?></div>
                    </div>                    
                    <form action="http://www.anguloweb.com.br/boletos/receptor.php" method="post" id="form_hidden" target="_blank">
                        <input type="hidden" name="cliente" value="conbrad">
                        
                        <input type="hidden" name="num_doc" value="<?php echo $inscricao->get_id(); ?>">
                        <input type="hidden" name="cpf" value="<?php echo $inscricao->get_cpf(); ?>">
                        <input type="hidden" name="nome" value="<?php echo $inscricao->get_nome(); ?>">
                        <input type="hidden" name="email" value="<?php echo $inscricao->get_email(); ?>">
                        <input type="hidden" name="cidade" value="<?php echo $inscricao->get_cidade(); ?>">
                        <input type="hidden" name="uf" value="<?php echo $inscricao->get_estado(); ?>">
                        <input type="hidden" name="endereco" value="<?php echo $inscricao->get_endereco(); ?>">
                        <input type="hidden" name="cep" value="<?php echo $inscricao->get_cep(); ?>">
                        <input type="hidden" name="telefone" value="<?php echo $inscricao->get_telefone(); ?>">
                        <input type="hidden" name="celular" value="<?php echo $inscricao->get_celular(); ?>">
                        <input type="hidden" name="dt_insc" value="<?php echo $inscricao->get_dt_insc(); ?>">
                        
                        <input type="submit" name="btn_imprimir" value="Imprimir boleto">
                    </form>
                    <?php
                    }
                    ?>
                    <br>
                    <label id=""><a href="index.php"><-- Voltar</a></label>
                </div>
<?php
unset($inscricao);
include_once "rodape.php";
?>
